package com.kun.controller.admin;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kun.service.RolePermissionService;

/**
 * @description: 
 * @author: KM
 * 2018年5月15日 下午3:30:18
 */
@Controller
@RequestMapping("/admin")
public class RoleAdminController {
	
	@Autowired
	private RolePermissionService rolePermissionService;
	
	@RequestMapping("/roleList")
	public String roleList(){
		return "admin/roleList";
	}
	
	//角色列表
	//@RequiresPermissions("bookInfo:view")
	@RequestMapping("/getRole")
	@ResponseBody
	public Map<String,Object> getRole(@RequestParam(name = "begin") int begin,
			@RequestParam(name = "length") int length,String jsonString){
		Map<String,Object> map = rolePermissionService.selectAllRole(begin, length, jsonString);
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("count",map.get("allRecord"));
		m.put("data",map.get("roleList"));
		m.put("code", 0);
		m.put("msg", "");
		return m;
	} 

}
